<?php
/**
 * Created by PhpStorm.
 * User: ybjaa
 * Date: 2017/7/19
 * Time: 15:44
 */

namespace database\model;


use Illuminate\Database\Schema\Blueprint;

class articles extends base
{
    public $table="articles";

    protected function setFileds(Blueprint $table)
    {
        parent::setFileds($table);

        $table->integer("type",false,true)->comment("文章类型：\n1:前端文章; 2:微信");
        $table->string("title",100)->comment("文章名称");
        $table->integer("weight",false,true)->comment("权重：值越大，默认排序越靠前");
        $table->text("content")->nullable()->comment("文章HTML内容");
        $table->text("contentText")->nullable()->comment("文章文本内容");
    }


    protected function setIndex(Blueprint $table)
    {

        $table->index(["type","weight","updated_at"],"type",IndexFunctionEnum::$BTREE);
        return parent::setIndex($table);

    }
}